{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "## About this notebook\n",
        "\n",
        "This notebook is designed for you to follow the instructions and learn more about how to use Colab's slideshow view of a notebook!\n",
        "\n",
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/googlecolab/colabtools/blob/main/notebooks/How_to_Use_Slideshow_Mode.ipynb#slideshowMode=true)\n",
        "\n",
        "## What is slideshow view?\n",
        "We break up the notebook into slides that you can flip through. Generally each cell is its own slide, with one special exception discussed later in this notebook.\n",
        "\n",
        "## Starting a slideshow\n",
        "You can start a slideshow by either:\n",
        "- from the notebook the header: **View** \u003e **Start slideshow from beginning**\n",
        "- from the command palette (`Ctrl` + `Shift` + `P`) and search for **Start notebook slideshow from beginning**\n",
        "- use the shortcut `Alt` + `Shift` + `V`\n",
        "- by adding **#slideshowMode=true** to the end of any Colab notebook URL\n",
        "\n",
        "## Slideshow Mode UI - controls at the bottom\n",
        "Use the controls at the bottom of the window navigate between slides\n",
        "\n",
        "- `|\u003c`: moves to first slide in the slide deck\n",
        "- `\u003c`: moves to the previous slide\n",
        "- `\u003e`: moves to the next slide\n",
        "- `\u003e|`: moves to the final slide in the slide deck\n",
        "\n",
        "Let's navigate to the next slide!\n"
      ],
      "metadata": {
        "id": "y_6ZCZg898ah"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Slideshow Mode UI - controls at the top\n",
        "- `pencil`: will toggle the markdown editor view for slides made from text cells\n",
        "- `gear`: opens settings for changing the aesthetic look of both the notebook and the slideshow\n",
        "  - **Theme**: light mode, dark mode, or adaptive, which copies the system default\n",
        "  - **Editor colorization**: Changes colorization for primarily code cells and code blocks. Some colorizations will also affect the background color of the notebook, such as `Dark` theme + `Synthwave84` editor colorization.\n",
        "  - **Kitty, Corgi, and Crab modes**: this activates cute pets in the header of the notebook or behind the bottom controls in slideshow mode\n",
        "- `four corners`: enters the slideshow into fullscreen\n",
        "- `x`: closes out of slideshow mode\n",
        "\n",
        "Let's go to the next slide!\n"
      ],
      "metadata": {
        "id": "NDhw2ttKAi9c"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# What to do if you accidentally exit slideshow mode\n",
        "\n",
        "Let's see how to get back to the slide we were on.\n",
        "\n",
        "1. Use the `x` button in the top right or `Escape` to exit slideshow mode.\n",
        "2. This cell should be focused in the notebook view!\n",
        "3. Restart the slideshow by:\n",
        "- using the **View** menu to select **Start slideshow**\n",
        "- using the command palette (`Ctrl` + `Shift` + `P`) to run **Start notebook slideshow**\n",
        "- or using the shortcut `Alt` + `V`\n",
        "4. We are back at our slide!\n",
        "\n",
        "This also works to arbitrarily start a slideshow from anywhere in your notebook by focusing the cell you want to start from."
      ],
      "metadata": {
        "id": "LNADWP_ZROgE"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Code cells in presentation mode\n",
        "\n",
        "So far we have only seen text cell slides, but code cells are also shown as slides and are executable in slideshow mode"
      ],
      "metadata": {
        "id": "YNergqj4NCC3"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# @title Hello World Example\n",
        "print(\"Hello World\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "JhfKwreWAtJx",
        "outputId": "154c7d68-b5e9-4a98-ccb9-66d513f56013"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Hello World\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# @title A More Interesting Output\n",
        "import numpy as np\n",
        "import IPython.display as display\n",
        "from matplotlib import pyplot as plt\n",
        "import io\n",
        "import base64\n",
        "\n",
        "ys = 200 + np.random.randn(100)\n",
        "x = [x for x in range(len(ys))]\n",
        "\n",
        "fig = plt.figure(figsize=(4, 3), facecolor='w')\n",
        "plt.plot(x, ys, '-')\n",
        "plt.fill_between(x, ys, 195, where=(ys \u003e 195), facecolor='g', alpha=0.6)\n",
        "plt.title(\"Sample Visualization\", fontsize=10)\n",
        "\n",
        "data = io.BytesIO()\n",
        "plt.savefig(data)\n",
        "image = F\"data:image/png;base64,{base64.b64encode(data.getvalue()).decode()}\"\n",
        "alt = \"Sample Visualization\"\n",
        "display.display(display.Markdown(F\"\"\"![{alt}]({image})\"\"\"))\n",
        "plt.close(fig)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 333
        },
        "id": "xeXJgLhQPykE",
        "outputId": "52ee4cb3-f384-4430-d4fd-27360659dfe7"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "\u003cIPython.core.display.Markdown object\u003e"
            ],
            "text/markdown": "![Sample Visualization]()"
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Special Case: a collapsible section that is one text cell + one code cell\n",
        "\n",
        "This is the special case mentioned on the first slide. If you use Colab's collapsible section feature to create a hierarchy to your cells and you have a section that only consists of a text cell explaining a concept and a code cell demonstrating the concept, they are grouped together into a single slide.\n",
        "Let's consider some example slides that could be included in an Intro to Python course where the students are learning about lists.\n",
        "\n",
        "---\n",
        "\n",
        "## Accessing an element\n",
        "\n",
        "Each item in a list has a particular position, or **index**. In most programming languages, lists are **zero-indexed**.\n",
        "\n",
        "This means that the first element in a list has index 0, the second has index 1, the third has index 2, etc.\n",
        "\n",
        "To access a particular element in a list, use its index:"
      ],
      "metadata": {
        "id": "hBOQF_izXvID"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "students = ['Mikayla', 'Julianne', 'Golnar']\n",
        "\n",
        "# This prints 'Mikayla'\n",
        "print(students[0])\n",
        "\n",
        "# This prints 'Julianne'\n",
        "print(students[1])\n",
        "\n",
        "# This prints 'Golnar'\n",
        "print(students[2])"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "d_ndTsxWYNKQ",
        "outputId": "78df0422-f4cf-425f-e229-73a8756b3ec0"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Mikayla\n",
            "Julianne\n",
            "Golnar\n"
          ]
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "This is another example slide that could be included in an Intro to Python course where the students are learning about lists.\n",
        "\n",
        "---\n",
        "\n",
        "## IndexError: list index out of range\n",
        "**Recall:**\n",
        "\n",
        "\n",
        "*   Lists are zero-indexed\n",
        "*   The bounds of a list index are 0 to `list size - 1`\n",
        "\n",
        "consider our list:\n",
        "```python\n",
        "students = ['Mikayla', 'Julianne', 'Golnar']\n",
        "```\n",
        "\n",
        "What happens if we try to access an item at an index that is not within the bounds of the list?"
      ],
      "metadata": {
        "id": "H7O5eALwNb6o"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 176
        },
        "id": "_eJzZ3k093uj",
        "outputId": "58321fa2-5a44-4a12-9844-51115f0f339a"
      },
      "outputs": [
        {
          "output_type": "error",
          "ename": "IndexError",
          "evalue": "list index out of range",
          "traceback": [
            "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
            "\u001b[0;31mIndexError\u001b[0m                                Traceback (most recent call last)",
            "\u001b[0;32m/tmp/ipython-input-3104921058.py\u001b[0m in \u001b[0;36m\u003ccell line: 0\u003e\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mstudents\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'Mikayla'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Julianne'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Golnar'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0mindex\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----\u003e 3\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstudents\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
            "\u001b[0;31mIndexError\u001b[0m: list index out of range"
          ]
        }
      ],
      "source": [
        "students = ['Mikayla', 'Julianne', 'Golnar']\n",
        "print(students[3])"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Slide Titles\n",
        "\n",
        "At the top left, you will see that we have the title of this notebook. The notebook title is the default title we use. If you use Colab's collapsible section feature to create a hierarchy to your cells, the slide title will be the header of the parent section.\n",
        "\n",
        "Let's look at an example starting with the next slide."
      ],
      "metadata": {
        "id": "c_Hrwk9jFJki"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# H1 header - a top level idea\n",
        "\n",
        "This is a text cell that starts with an h1 header on the first line. The title is still the notebook title because an h1 header is considered the top of the hierarchy. This creates the beginning of our collapsible section!"
      ],
      "metadata": {
        "id": "nkmUVIbfJN9w"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## H2 header - a subsection\n",
        "\n",
        "This text cell start with an h2 header on the first line. This nestles under our h1 header in the notebook Table of Contents, and that hierarchy is preserved here. The slide title matches our parent header."
      ],
      "metadata": {
        "id": "x6em6XezJRqI"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### H3 header - further into the weeds\n",
        "\n",
        "As you can see, as you go down the header hierarchy, we can see the header from the previous level as the title."
      ],
      "metadata": {
        "id": "Vzxmj3a9KFEU"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## another H2 header - another subsection\n",
        "\n",
        "and you can go back up the hierarchy"
      ],
      "metadata": {
        "id": "bjUB4cJgK93C"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Text cells with no header get folded into the last section defined. This can be useful for formatting if you want to have your section title stand on its own and then have the content on the next slide. The next two slides demonstrate what that looks like."
      ],
      "metadata": {
        "id": "3zkCMCEoL2eI"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# An exciting title for the section"
      ],
      "metadata": {
        "id": "j4-ODCchMFxh"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "Some exciting content that is elaborated on.\n",
        "\n",
        "---\n",
        "\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\""
      ],
      "metadata": {
        "id": "zen9iTbGMTCr"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# That's all for now!\n",
        "\n",
        "Thanks for using Colab! We hope you learned what you need to know to make beautiful slideshows out of your notebooks!\n",
        "\n",
        "Please let us know if there are ways we can improve by using the links in the `Help` menu to `Report a bug` or `Send feedback`"
      ],
      "metadata": {
        "id": "v7qshjsBGlHg"
      }
    }
  ]
}
